package com.example.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;


/**
 * @ author:lin tingfeng
 * @ data:2021/9/7-1:06
 */
@Configuration
public class MyMvcConfig implements WebMvcConfigurer {
    // ViewResolver 实现了视图解析器接口类，我们就可以把它看作视图解析器 insertStudent managementPower

    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        registry.addViewController("/").setViewName("login");
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LoginHandlerInterceptor()).addPathPatterns("/changePassword");
        registry.addInterceptor(new LoginHandlerInterceptor()).addPathPatterns("/managementStudent", "/managementPower", "/managementGrade");
        registry.addInterceptor(new LoginHandlerInterceptor()).addPathPatterns("/updateStudent");
        registry.addInterceptor(new LoginHandlerInterceptor()).addPathPatterns("/home", "/personalInformation");
        registry.addInterceptor(new LoginHandlerInterceptor()).addPathPatterns("/auditRequest");
    }
}

